#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>

const int N = 2e5 + 10;



using namespace std;


bool check(int lastl, int firstr, string& s){
    if(lastl == -1 || firstr == 1e9 + 10){
        return true;
    }

    swap(s[lastl], s[firstr]);
    int sum = 0;
    for (int i = 0; i < s.length(); i ++){
        if(s[i] == '('){
            sum++;
        }else{
            sum--;
            if(sum < 0){
                return true;
            }
        }
    }

    return false;
}

int main(){

    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    int T;
    cin >> T;

    string s;
    while(T--){
        cin >> s;

        int ln = s.length() / 2, rn = s.length() / 2;
        for (int i = 0; i < s.length(); i ++){
            if(s[i] == '('){
                ln--;
            }else if(s[i] == ')'){
                rn--;
            }
        }

        int lastl = -1, firstr = 1e9 + 10;
        for (int i = 0; i < s.length(); i ++){
            if(s[i] == '?'){
                if(ln){
                    s[i] = '(';
                    ln--;
                    lastl = i;
                }else if(rn){
                    s[i] = ')';
                    if(firstr == 1e9 + 10){
                        firstr = i;
                    }
                    rn--;
                }
            }
        }

        if(check(lastl, firstr, s)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }

    return 0;
}